package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.InoutProduct;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class InoutProductDTO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "出入库id")
    private Integer inoutId;

    @ApiModelProperty(value = "领用商品id")
    private Integer claimsProductId;

    @ApiModelProperty(value = "初始数量")
    private Double inceptionNum;

    @ApiModelProperty(value = "预估出入数量")
    private Double inoutNum;

    @ApiModelProperty(value = "最终数量")
    private Double finallyNum;

    @ApiModelProperty(value = "实际数量")
    private Double actualNum;

    @ApiModelProperty(value = "单位id")
    private Integer unitId;

    @ApiModelProperty(value = "规格名称")
    private String specificationName;

    @ApiModelProperty(value = "商品spu名称")
    private String productSpuName;

    @ApiModelProperty(value = "单位名称")
    private String unitName;


    public InoutProductDTO() {}

    public InoutProductDTO(InoutProduct entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static InoutProductDTO convert(InoutProduct entity) {
        return new InoutProductDTO(entity);
    }

    public static List<InoutProductDTO> convertList(List<InoutProduct> list) {
        List<InoutProductDTO> resultList = new ArrayList<>();
        for (InoutProduct entity : list) {
            resultList.add(new InoutProductDTO(entity));
        }
        return resultList;
    }}
